package com.Txunda.fxw.ui.adapter;

import com.Txunda.fxw.R;
import com.Txunda.fxw.ui.callback.MyItemClickListener;
import com.Txunda.fxw.ui.adapter.model.DetailRecyclerHolder;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class DetailViewAdapter extends RecyclerView.Adapter<DetailRecyclerHolder>{

	private int[]imgs;
	private String[]datas;
	MyItemClickListener itemClickListener;
	Context mContext;
	
	public int[] getImgs() {
		return imgs;
	}

	public void setImgs(int[] imgs) {
		this.imgs = imgs;
	}

	public String[] getDatas() {
		return datas;
	}

	public void setDatas(String[] datas) {
		this.datas = datas;
	}
	public DetailViewAdapter(Context context,MyItemClickListener itemClickListener) {
		this.mContext = context;
		this.itemClickListener = itemClickListener;
	}

	@Override
	public int getItemCount() {
		return imgs.length;
	}

	@Override
	public void onBindViewHolder(DetailRecyclerHolder holder, final int position) {
      	holder.getTv_detail_img().setImageResource(imgs[position]);
      	holder.getTv_detail_title().setText(datas[position]);
      	holder.itemView.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				//Toast.makeText(mContext, "�����"+position, Toast.LENGTH_SHORT).show();
			}
		});
	}

	@Override
	public DetailRecyclerHolder onCreateViewHolder(ViewGroup arg0, int arg1) {
		View view = LayoutInflater.from(mContext).inflate(R.layout.item_layout_detail, null);
		DetailRecyclerHolder detailRecyclerHolder =new DetailRecyclerHolder(view);		
		return detailRecyclerHolder;
	}

}
